﻿/*!	@file	r_scenegraph_link.h
	@brief	シーングラフリンク
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#ifndef _R_SCENEGRAPH_LINK_H_
#define _R_SCENEGRAPH_LINK_H_

#include "../rtti/r_rtti_class_base.h"
#include "../util/r_util_stdstring.h"

#include <vector>

class cRSceneGraphNode;
typedef	std::vector<cRSceneGraphNode*, tRAllocDeclared<cRSceneGraphNode*, eRAllocDef_SceneGraph>>	cRSceneGraphNode_array;

//! シーングラフノード
/*! シーングラフから派生するクラスの直接deleteを禁止します。
*/
class cRSceneGraphLink : public r::rtti::ClassBase
{
	RRTTI_REFLECTION_DECLARE
public:
	RALLOC_PLACEMENT_NEW_DELETE_DEF ( eRAllocDef_SceneGraph )
	//! コンストラクタ
	/*!
	*/
	cRSceneGraphLink();
	//! デストラクタ
	/*!
	*/
	virtual	~cRSceneGraphLink();
public:
	//! 入力の追加
	/*!
	*/
	virtual	void					addSource ( cRSceneGraphNode* src );
	//! 入力数の取得
	/*!
	*/
	virtual	r_size					getSourceNum() const;
	//! 入力の取得
	/*!
	*/
	virtual const cRSceneGraphNode*	getSource ( r_size index ) const;
	//! ソースの削除
	/*!
	*/
	virtual	void					removeLink ( r_size index );
	virtual	void					removeLink ( const cRSceneGraphNode* src );
	//! リンク処理の実行
	/*!
	*/
	virtual void					execute ( cRSceneGraphNode* dst );
protected:
	//! リンクソース
	cRSceneGraphNode_array			source;
};

#endif // _R_SCENEGRAPH_LINK_H_

